package com.example.sneakerappserver.controller;

import com.example.sneakerappserver.pojo.Goods;
import com.example.sneakerappserver.pojo.ResponseMessage;
import com.example.sneakerappserver.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController // 接口方法返回对象 转换成json文本
@RequestMapping("/goods")    // localhost:8088/user/**
public class GoodsController {

    @Autowired
    private IGoodsService goodsService;

    @GetMapping("/all")
    public ResponseMessage<List<Goods>> getAllGoods() throws IOException {



        List<Goods> all = goodsService.queryAllGoods();
        return ResponseMessage.success(all);
    }
}
